package com.yang.bean.beanfactory.impl;

import com.yang.bean.beanDefinition.BeanDefinition;
import com.yang.bean.beanfactory.registry.BeanDefinitionRegistry;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description: 注册BeanDefinition接口的实现类, 功能就是注册BeanDefinition
 * @author: Yang Qiang
 * @create: 2021-11-08 21:10
 */
public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFactory implements BeanDefinitionRegistry {
    // 对应的就是spring的bdmap;
    private Map<String, BeanDefinition> beanDefinitionMap = new HashMap<>();


    // 返回BeanDefinition对象
    @Override
    public BeanDefinition getBeanDefinition(String name) {
        return beanDefinitionMap.get(name);
    }

    // 放入BeanDefinition对象到Map
    @Override
    public void registryBeanDefinition(String name, BeanDefinition beanDefinition) {
        beanDefinitionMap.put(name, beanDefinition);
    }
}
